Fix some stat-related races.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Oct 2012 00:52:01 +0000 (17:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Oct 2012 00:52:01 +0000 (17:52 -0700)
commit550203e285938aa75f9f3edc53c5bb4b06f4eae8
tree57b3d61dbc076114b82dbcc91d3b5d1a47d737fe
parent8aa0caee3522662a90a76b8fb2ec02ea2ee23b2a
Fix some stat-related races.

* fileio.c (Fwrite_region): Avoid race condition if a file is
removed or renamed by some other process immediately after Emacs
writes it but before Emacs stats it.  Do not assume that stat (or
fstat) succeeds.
* image.c (slurp_file): Resolve the file name with fopen + fstat
rather than stat + fopen.
(pbm_read_file) [0]: Remove unused code with stat race.
* process.c (allocate_pty) [HAVE_PTYS && !PTY_ITERATION && !PTY_OPEN]:
Remove ineffective code with stat race.
src/ChangeLog
src/fileio.c
src/image.c
src/process.c